package com.e3.basdoc.bank.service;

import java.util.List;

import com.e3.basdoc.bank.model.BankModel;
import com.e3.core.base.ModelCacheManager;

public class BankCacheManager extends ModelCacheManager<BankModel> {
	public final static String BANK_CACHE = "BANK_CACHE";
	
	public static BankCacheManager INSTANCE = new BankCacheManager();
	
	public void put(BankModel model){
		putModel(BANK_CACHE, model);
		BankModel pModel = model.getParentBank();
		if(pModel!=null){
			BankModel pcModel = get(pModel.getId());
			if(pcModel!=null){
				pcModel.setHasChildren(true);
			}
		}
	}

	public BankModel get(Long id) {
		return getModel(BANK_CACHE, id);
	}
	
	public void remove(List<Long> ids){
		removeModels(BANK_CACHE,ids);
	}

}
